package com.lfy.modules.blog.controller;

import com.lfy.modules.blog.domain.dto.article.CommentDTO;
import com.lfy.modules.blog.domain.group.AdminGroup;
import com.lfy.modules.blog.domain.group.WebGroup;
import com.lfy.modules.blog.domain.vo.article.ArticleTitleAndIdVO;
import com.lfy.modules.blog.service.ArticleCommentService;
import com.lfy.modules.blog.service.ArticleService;
import com.lfy.modules.common.domain.R;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 评论管理
 */
@RestController
@RequestMapping("admin/comment")
public class CommentController {

    @Resource
    private ArticleService articleService;
    @GetMapping("/get/article/list")
    public R<List<ArticleTitleAndIdVO>> getArticleList() {
        return articleService.getAllArticleTitleAndId();
    }
    @PostMapping("/send")
    public R<Void> comment(@RequestBody @Validated(AdminGroup.class) CommentDTO dto){
        return articleService.comment(dto);
    }
    @PostMapping("/delete/{id}/{articleId}")
    public R<Void> deleteComment(@PathVariable("id") Long id, @PathVariable("articleId") Long articleId){
        return articleService.deleteComment(id,articleId);
    }
}
